package com.nongcai159.mall.lib_common.impl

import android.view.View

import java.util.Calendar

/**
 * 按钮防抖动
 *
 * Created by tanbiheng on 2017/9/27.
 */

class LimitClickHelper(private val iLimitClick: ILimitClick) : View.OnClickListener {
    private val LIMIT_TIME = 600

    private var lastClickTime: Long = 0

    override fun onClick(v: View) {
        val curTime = Calendar.getInstance().timeInMillis
        if (curTime - lastClickTime > LIMIT_TIME) {
            lastClickTime = curTime
            iLimitClick.onClick(v)
        }
    }
}
